package com.mikufufu.blog.listener.impl;

import com.alibaba.fastjson2.JSON;
import com.mikufufu.blog.listener.BaseListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class DemoListener implements BaseListener {
    @Override
    public void onMessage(Message message, byte[] pattern) {
        // 处理Redis消息
        log.debug("Received message: {}", JSON.parseObject(message.getBody(), String.class));
    }

    @Override
    public String getTopic() {
        return "demoTopic";
    }

    @Override
    public int topicType() {
        return 0;
    }
}
